package com.weixing.mall.provider.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weixing.mall.provider.mapper.SealMatchRuleMapper;
import com.weixing.mall.provider.model.domain.SealMatchRule;
import com.weixing.mall.provider.model.dto.SealMatchRuleDto;
import com.weixing.mall.provider.service.ISealMatchRuleService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 仓库模块-封单匹配规则 服务实现类
 * </p>
 *
 * @author Small
 * @since 2019-11-15
 */
@Service
public class SealMatchRuleServiceImpl extends ServiceImpl<SealMatchRuleMapper, SealMatchRule> implements ISealMatchRuleService {



    @Override
    public void save(SealMatchRuleDto sealMatchRuleDto) {
        SealMatchRule sealMatchRule = new SealMatchRule();
        BeanUtils.copyProperties(sealMatchRuleDto,sealMatchRule);
        sealMatchRule.setCreatedTime(new Date());
        if(sealMatchRuleDto.getId()==null){
            save(sealMatchRule);
        }else {
            updateById(sealMatchRule);
        }
    }

    @Override
    public IPage selectOfPage(Page page) {
        return baseMapper.selectOfPage(page);
    }
}
